!% -SD !Laura, by Michael Thomét (cobalt) !Created for Interactive Fiction Writing Month !Week Two Submission !v .1 !This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License. !======================================= Constant Story "Laura"; Constant Headline "^Laura By Michael Thomét^"; Include "Parser"; Include "VerbLib"; !======================================= !Attributes attribute sharp; !======================================= !Classes Class s_clothesline (20) !The complicated and frustrating ropes. with name 'clothes' 'line' 'clothesline' 'clothelines//p', short_name [; print self.o_length, "-foot length of clothesline"; rtrue;], plural [; print self.o_length, "-foot lengths of clothesline"; rtrue;], hardness 3, o_length, tied false, parse_name [x j i flag; if (parser_action == ##TheSame) { if (parser_one.o_length ~= parser_two.o_length) return -2; return -1; } for (:: i++, flag = false) {; switch (NextWordStopped()) { 'clothes', 'line', 'clothesline', 'foot': flag = true; 'clotheslines': flag = true; parser_action = ##PluralFound; !requesting objects by length '1//', 'one', 'one-foot', '1-foot': if(self.o_length == 1) flag = true; else flag = false; '2//', 'two', 'two-foot', '2-foot': if(self.o_length == 2) flag = true; else flag = false; '3//', 'three', 'three-foot', '3-foot': if(self.o_length == 3) flag = true; else flag = false; '4//', 'four', 'four-foot', '4-foot': if(self.o_length == 4) flag = true; else flag = false; '5//', 'five', 'five-foot', '5-foot': if(self.o_length == 5) flag = true; else flag = false; '6//', 'six', 'six-foot', '6-foot': if(self.o_length == 6) flag = true; else flag = false; '7//', 'seven', 'seven-foot', '7-foot': if(self.o_length == 7) flag = true; else flag = false; '8//', 'eight', 'eight-foot', '8-foot': if(self.o_length == 8) flag = true; else flag = false; 'first', '1st': !The 'first' through 'eighth' problem objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 1) { if(self == x) flag = true; else flag = false; } } 'second', '2nd': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 2) { if(self == x) flag = true; else flag = false; } } 'third', '3rd': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 3) { if(self == x) flag = true; else flag = false; } } 'fourth', '4th': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 4) { if(self == x) flag = true; else flag = false; } } 'fifth', '5th': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 5) { if(self == x) flag = true; else flag = false; } } 'sixth', '6th': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 6) { if(self == x) flag = true; else flag = false; } } 'seventh', '7th': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 7) { if(self == x) flag = true; else flag = false; } } 'eighth', '8th': objectloop(x provides o_length && x.o_length == self.o_length && x in location && x ofclass s_clothesline) { if(x in location) j++; if(j == 8) { if(self == x) flag = true; else flag = false; } } -1: return i; default: return i; } if (flag == false) return i; } ], create [ len loc; self.o_length = len; move self to loc; ], description [; switch(self.o_length){!Variable description 1: "A small section of strudy clothesline, about one foot in length. Only the Master's socks will fit on it now. Whatever have you done?"; 2: "A small section of strudy clothesline, about two feet in length. You might still be able to fit one of Master's shirts on the clothesline."; 3: "A section of strudy clothesline, about three feet in length. You could still use this to hold a pair of trousers and Master's pants."; 4: "A section of strudy clothesline, about four feet in length. You could probably fit one of Master's shirts and undershirt on the line."; 5: "A small section of strudy clothesline, about five feet in length. You're sure you could fit all of Master's underwears on a line this size."; 6: "A large section of sturdy clothesline, about six feet in length. Master's coat, shirt and socks would probably fit on here all at once."; 7: "A large section of sturdy clothesline, about seven feet in length. You could fit Master's entire outfit, besides his undershirt on here."; 8: "A large section of sturdy clothesline, about eight feet in length. Master's whole outfit fits on line of this length."; default: "A section of clothesline about ", self.o_length, " feet in length."; } ], before [; myCut: if(newPlayer hasnt second) "You're not holding ", (the) second, "."; if(second provides hardness) { if(noun provides o_length) { if(second.hardness > self.hardness) { if(noun.o_length / 2 > 1 || noun.o_length == 2) { s_clothesline.create(self.o_length / 2, parent(self)); s_clothesline.create(self.o_length / 2, parent(self)); s_clothesline.destroy(self); "You cut the clothesline in half."; } print_ret (The) noun, " is too small to cut any further."; } "You try to use ", (the) second, " to cut ", (the) noun, ", but ", (the) second, " is not strong enough."; } "You can't divide something like that."; } "There is no edge on ", (the) second; Tie: if(second == nothing && noun.o_length > 3) { if(noun.tied == true) "You've already made a loupe in ", (the) noun; noun.tied = true; "You tie a loupe in ", (the) noun; } if(noun == second) { <>; } if(second ofclass s_clothesline) { s_clothesline.create(noun.o_length + second.o_length, temp_holder); move temp_holder to parent(noun);!A hack for keeping track of instanced objects move noun to child(temp_holder); !I used the parent/child tree to create a fake container move second to child(temp_holder);!to make a legacy of objects that made up the object after move child(temp_holder) to parent(temp_holder);!being tied to another piece. remove temp_holder; "You tie ", (the) noun, " to ", (the) second, "."; } Untie: if(second == nothing) { if(children(noun) == 2) { move child(noun) to parent(noun); move child(noun) to parent(noun); print "You untie ", (the) noun, " from ", (string) PronounNom(noun), "self."; s_clothesline.destroy(noun); rtrue; } if(noun provides tied && noun.tied == true) { noun.tied = false; "You remove the loupe from ", (the) noun; } rfalse; } if(noun == second) <>; ]; !======================================= ! Game Objects Object Kitchen "Kitchen" with description "In the center of the kitchen is a large, square table, made of white ash. There is only about two feet of space between the table and the cabinets, a space to which you have become accustomed. The cabinets are also made of ash, but have greyed with time. The most amount of space available is in front of the gas stove, set back against the corner opposite the doorway into the living quarters. A gas lamp is set into the wall by the doorway but Master Rogan forbids its use. Kitchen work should be done by sundown, when the Master arrives home. You can go into the living quarters from here.", s_to Living, has light; !Objects needed: table, stove, cabinets, gas lamp, gas valve?, icebox? Object toKitchen "doorway" with description "", name 'kitchen', before [; Go, Enter: if(self in Kitchen) "You look around and realize that you're already there."; <>; Exit: if(self notin Kitchen) "But you aren't in the kitchen, you realize."; <>; ], found_in Living Kitchen, has scenery concealed; Object k_knife "kitchen knife" Kitchen with description "A sharp knife, used to chop potatoes and separate chicken.", hardness 5, name 'knife' 'blade' 'sharp', has sharp; Object Bedroom "Master's Bedroom" with description "The main features of Master Rogan's bedroom are his large, four post bed and his vanity. The bed sits in the middle of the wooden floor, the frame made from a dark wood. The vanity sits next to a small wardrobe, upon which a hook rests for the hanging of Master's coat. On the other side of the bed is Master's bathtub, which he uses every Saturday, and which you fill with hot water heated on the stove in a large washbasin. A gas lamp is set in the wall beside Master's vanity. Every morning you come here to fetch the Master's clothing and set the bed. You can go back into the living quarters from here.", e_to Living, has light; !objects needed: bed, vanity, tub, wardrobe, lamp Object toBedroom "doorway" with description "", name 'master^s' 'bedroom' 'master', before [; Enter: if(self in Bedroom) "You look around and realize that you're already there."; <>; Exit: if(self notin Bedroom) "But you aren't in Master's bedroom, you realize."; <>; ], found_in Living Bedroom, has scenery concealed; Object Living "Living Quarters" with description "The only room with two gas lamps, the Living Quarters is a long, narrow room. At the end nearest the kitchen, a small table for dining has been set up. One of the gas lamps rests in the wall above the table. At the other end, near the stairs to the second floor, a wide, low bookshelf rests against the wall. A fireplace sits on the outer wall, in front of which is the Master's reading chair. The other gas lamp sits at the bottom of the stairs, opposite to the fireplace. Occasionally, Master Rogan entertains guests, and you have to bring extra chairs from the laundry upstairs. The door outside is in the center of the room, a few feet from the fireplace. You can go upstairs, into the kitchen and into Master Rogan's bedroom from here.", w_to Bedroom, n_to Kitchen, u_to Hallway, has light; !objects needed: table, chair, bookshelf, fireplace, door, lamp1, lamp2 Object toLiving "doorway" with description "", name 'living' 'quarters//p', before [; Go, Enter: if(self in Living) "You look around and realize that you're already there."; if(self in Kitchen) <>; if(self in Bedroom) <>; if(self in Hallway) <>; Exit: if(self notin Living) "But you aren't in the living quarters, you realize."; "You'll need to decide on somewhere to go."; ], found_in Kitchen Bedroom Hallway Living, has scenery concealed; Object Hallway "Servants' Hall" with description "The hallway is a small, narrow room at the top of the stairs. A rug has been placed over the wooden floor to protect it from your shuffling in this space between the laundry, the servants' quarters and the linen closet. This is the only room of the house that has no lighting. You can go to the laundry, your quarters, the linen closet, and downstairs to the living quarters from here.", d_to Living, n_to Laundry, s_to Quarters, e_to Linen, has light; !Objects needed: rug Object toHallway "doorway" with description "", name 'hallway' 'hall' 'servant^s' 'servant' 'stairs//p', before [; Go, Enter: if(self in Hallway) "You look around and realize that you're already there."; if(self in Living) <>; if(self in Quarters) <>; if(self in Linen) <>; if(self in Laundry) <>; Exit: if(self notin Hallway) "But you aren't in the servant's hall, you realize."; "You'll need to decide on somewhere to go."; ], found_in Living Quarters Linen Laundry Hallway, has scenery concealed; Object Laundry "Laundry" with description "The laundry is a large room that sits over the kitchen. Sometimes you can smell the day's cooking while you are washing the Master's clothes. The room contains a small gas stove for heating wash water and a sink where you clean any dishes used during the day. There is also a cushioned chair, your only comfort, for when you have to do mending on your's or Master's clothes. There is also a clothesline from which you hang the wash to dry. A large window sits in front of the line, opened on dry days to help the drying. A gas lamp sits in the wall over the stove. You can go to the hallway from here.", s_to Hallway, has light; !Objects needed: stove, lamp, sink, window Object toLaundry "doorway" with description "", name 'laundry', before [; Go, Enter: if(self in Laundry) "You look around and realize that you're already there."; <>; Exit: if(self notin Laundry) "But you aren't in the laundry, you realize."; <>; ], found_in Hallway Laundry, has scenery concealed; Object clothesline "clothesline" Laundry with description "The closeline where you hang the Master's clothes.", hardness 3, o_length 8, before [; myCut: if(second provides hardness) { if(noun provides o_length) { if(second.hardness > self.hardness) { if(noun.o_length / 2 > 1 || noun.o_length == 2) { s_clothesline.create(noun.o_length, parent(self)); remove self; "You cut through the thick clothesline with ", (the) second, " and watch it fall to the floor. Now there is nothing on which to dry the Master's clothes."; } print_ret (The) noun, " is too small to cut any further."; } "You try to use ", (the) second, " to cut ", (the) noun, ", but ", (the) second, " is not strong enough."; } print_ret "You can't divide something like that."; } "There is no edge on ", (the) second; ], name 'clothesline' 'clothes//p' 'line', has scenery; Object Quarters "Servants' Quarters" with description "Your place of refuge. Your room, which you share with the groundskeeper, Stephen, is a tiny room where you spend about six hours a night, forgetting the life you've been given. A bunk bed sits against the wall, in front of the window that faces the morning sun. A small wardrobe sits next to the doorway, containing the thin clothes that you and Stephen both wear. An oil lamp hangs from a sturdy hook secured to a thick beam in the celing, the only room with oil lighting. Master Rogan gives you very little oil to fill the lamp. You can go to the hallway from here.", n_to Hallway, has light; !Objects needed: top bunk, bottom bunk, lamp, hook, beam, window Object toQuarters "doorway" with description "", name 'servants^' 'servants' 'servant' 'quarter' 'quarters//p', before [; Go, Enter: if(self in Quarters) "You look around and realize that you're already there."; <>; Exit: if(self notin Quarters) "But you aren't in your quarters, you realize."; <>; ], found_in Hallway Quarters, has scenery concealed; Object sq_hook "sturdy hook" Quarters with description "A thick, iron hook driven into a wooden beam.", name 'sturdy' 'hook', capacity 1, react_before [; Puton: if(children(self) >= self.capacity) "There's enough on the hook already."; if(child(top_bunk) ~= newPlayer) "You're too far away from ", (the) self, "."; if(noun provides o_length && noun provides tied) { if(noun.tied == false) { move noun to parent(self); "You place ", (the) noun, " on ", (the) self, " and watch as it slides off and onto the floor."; } move noun to self; "The loupe of ", (the) noun, " tightens over ", (the) self, "."; } "That isn't something that you can put on the hook."; !fix to put the lamp back on there! Take: if(child(top_bunk) ~= newPlayer) "You're too far away from ", (the) self, "."; if(noun == self) "The hook is too firmly attached."; ], has scenery concealed supporter transparent; Object sq_lamp "oil lamp" sq_hook with description "An oil lamp.", name 'oil' 'lamp', has concealed; Object top_bunk "top bunk" Quarters with description "Your bunk.", name 'top' 'bunk' 'bed', add_to_scope sq_lamp, capacity 1, has supporter scenery concealed enterable transparent; Object Linen "Linen Closet" with description "This room, which is the same size as your own quarters, is lined on one wall with shelves, upon which are a number of linens. Master Rogan has a wide variety, depending on the weather. The linens for your bed are on a separate shelf, with much smaller of a selection. A tiny gas lamp sits next to the way to the hallway.", w_to Hallway, has light; !Objects needed: shelves, linens, cheap linens, small shelves, lamp. Object toLinen "doorway" with description "", name 'linen' 'closet', before [; Go, Enter: if(self in Linen) "You look around and realize that you're already there."; <>; Exit: if(self notin Linen) "But you aren't in the linen closet, you realize."; <>; ], found_in Hallway Linen, has scenery concealed; !======================================= ! Player Objects Object newPlayer "yourself" with description "It's just little, old, insignificant you.", react_before [; Kill: if(noun == self) "You couldn't do that, no. Maybe. But how?"; if(noun has animate) print_ret "You couldn't do that to ", (the) noun, ", not after all ", (string) PronounNom(noun), " has done for you."; print_ret "You aren't sure how you could do that to ", (the) noun; ], has concealed animate proper transparent; Object temp_holder "temporary holder" with description ""; !======================================= ! Entry Point Routines [ Initialise; banner(); move newPlayer to Kitchen; ChangePlayer(newPlayer); print "^When you were very young, you were bought by Master Rogan to do housework, and have lived in his house ever since. It's been twenty years. You've gotten into a routine, between the beatings and sleepless nights. The best refuge you get is when you get to mend clothes, able to sit down in a nice chair and to the mindless work, left to your thoughts. You always are thinking to yourself, ~Laura, is there anything else out there, beyond the door?~, but there's nothing you can do to find out.^"; return 2; ]; !======================================= ! Other Routines Routines [ PronounAcc i; if (i hasnt animate || i has neuter) return "it"; else { if (i has female) return "her"; else return "him"; }]; [ PronounNom i; if (i hasnt animate || i has neuter) return "it"; else { if (i has female) return "she"; else return "he"; }]; [ CPronounNom i; if (i hasnt animate || i has neuter) return "It"; else { if (i has female) return "She"; else return "He"; } ]; !======================================= ! Grammars Include "Grammar"; extend only 'kill' 'murder' replace * noun -> Kill; extend only 'run' replace * 'away' -> RunAway * noun -> Go * enterable -> Enter; extend only 'q//' 'quit' replace * -> NoQuit; verb 'end' * 'life' -> EndLife * 'game' -> Quit; extend only 'die' replace * -> myDie; extend only 'exit' * 'game' -> Quit; extend only 'cut' replace * noun noun -> myCut * noun 'with' noun -> myCut; verb 'untie' * noun -> Untie * noun noun -> Untie * noun 'from' noun -> Untie; [KillSub; <>;]; [UntieSub; print_ret (The) noun, "isn't attached to anything.";]; [EndLifeSub; <>;]; [myDieSub; "You couldn't.";]; [RunAwaySub; "And go where? You wear the mark of ownership. You can't run away.";]; [NoQuitSub; "You can't quit. Master Rogan owns you. There is no quitting.";]; [myCutSub; if(noun provides hardness) { if(second provides hardness) { if(second.hardness > noun.hardness) { move noun to actor; "You cut through ", (the) noun, " with ", (the) second, " ."; } "You try to use ", (the) second, " to cut ", (the) noun, " but ", (the) second, " is not strong enough."; } "There is no edge on ", (the) second; } ];